﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using WebSiteAdminTool.UI.Utils.Commands;
using System.Linq;
using WebSiteAdminTool.UI.Views.Security;
using WebSiteAdminTool.UI.Services;
using System.ComponentModel;
using GalaSoft.MvvmLight.Messaging;
using GalaSoft.MvvmLight;

namespace WebSiteAdminTool.UI.ViewModels.Base
{
    public abstract class BaseViewModel : ViewModelBase
    {
        #region private data

        private bool _isInitializing;

        #endregion

        #region ctors

        public BaseViewModel()
        {
        }

        #endregion

        #region virtual methods

        protected virtual void InitViewModel()
        {
            // initialization stage
            _isInitializing = true;
            InitializeCommands();
            SetDefaultValues();
            RegisterListeners();
            _isInitializing = false;

            // data loading stage
            LoadData();
        }

        protected virtual void SetDefaultValues()
        {
        }

        protected virtual void InitializeCommands()
        {
        }

        protected virtual void RegisterListeners()
        {
        }

        protected virtual void LoadData()
        {
        }
             
        #endregion

        #region public props

        public bool IsInitializing
        {
            get
            {
                return _isInitializing;
            }
        }

        #endregion
    }
}
